<template>
  <div class="my_index">
    <div class="container">
      <div class="item header">
        <div class="station">油站</div>
        <div class="oil">油品</div>
        <div class="guide">指导价</div>
        <div class="origin">挂牌价</div>
        <div class="discount">优惠价</div>
      </div>
      <div class="item" v-for="item in priceList">
        <div class="station">{{item.stationName || "-" }}</div>
        <div class="oil">{{item.oilName || "-" }}</div>
        <div class="guide">{{ item.oilOfficialPrice || "-"}}</div>
        <div class="origin">{{item.oilStationPrice || "-" }}</div>
        <div class="discount">{{item.discountPrice || "-" }}</div>
      </div>
    </div>
    <!--<div class="goApplet">去加油</div>-->
  </div>
</template>

<script>
import { mapState, mapGetters, mapActions } from "vuex";
import  requst  from "@/utils/request.js";
export default {
  head() {
    return {
      title: "油价",
    };
  },
  data() {
    return {
      showGoApplet: false,
      priceList:[]
    };
  },
  components: {},
  computed: {
    ...mapGetters({
      userInfo: "authen/userInfo",
    }),
    ...mapState({
      // pointInfo: (state) => state.point.pointInfo,
    }),
  },
  mounted() {
    // this.getPointInfo();
    // console.log()
  },
  created() {
    if(!this.enterpriseId){
      return
    }
    // console.log(requst);
    // if (this.unionId) {
    //   this.goto();
    // }
  
    requst({
        url: '/stationOillGun/info/gzhList',
        method: 'get',
        params: {
          enterpriseId:this.enterpriseId,
          stationId:this.$route.query.stationId
        }
    }).then((result) => {
      console.log('成功',result);
      this.priceList = result.rows;
    }).catch((err) => {
      console.log("失败",err);
    });
  },
  methods: {
    ...mapActions({
      // getPointInfo: "point/getPointInfo",

    }),
    ...mapActions({
      getSdkConfig: "authen/getSdkConfig",
    }),
    goto() {
      const that = this;
        this.getSdkConfig({
          jsApiList: ["wx-open-launch-weapp"],
          openTagList: ["wx-open-launch-weapp"],
        }).then((res) => {
          wx.config(res);
          wx.error(function (err) {
            console.log(err);
            that.showGoApplet = false;
          });
        });
    },
  },
};
</script>

<style lang="scss" >
.my_index {
  padding: 0.2rem;
  padding-bottom: 0;
  width: 100vw;
  box-sizing: border-box;
  background-color: #f3e6e6;
  // background-image: linear-gradient(to bottom, #2e73ff 15%, #f7f7f7 60%);
  background-repeat: no-repeat;
  min-height: 100vh;
  .container{
    width:100%;
    text-align: center;

    margin-top:1rem;

    .item{
      text-align: center;
      display: flex;
      justify-content:space-between;
      align-items: center;
      height: 1rem;
      background-color:#fff;
      div{
        width: 1rem;
        background-color:#f0f0f0;
        height: .6rem;
        line-height: .6rem;
        border-radius:.2rem;
        font-size:.25rem;
        font-weight: bolder;
      }
      .station{
        width:1.5rem;
        white-space: nowrap;
        /* 超出盒子部分隐藏 */
        overflow: hidden;
        /* 文本超出的部分打点显示 */
        text-overflow: ellipsis;
      }
    }
    .header{
      div{
        background-color:#bbbda6;
      }
    }
  }
}
</style>
